package com.logictech.lims.dao.impl;

import java.util.List;

import org.jeecgframework.p3.core.utils.common.PageQuery;
import org.jeecgframework.p3.core.utils.common.PageQueryWrapper;
import org.jeecgframework.p3.core.utils.persistence.mybatis.GenericDaoDefault;
import org.springframework.stereotype.Repository;
import com.logictech.lims.dao.PreparationInventoryDao;
import com.logictech.lims.dto.PreparationInventoryDto;
import com.logictech.lims.entity.PreparationInventory;

/**
 * 描述：</b>PreparationInventoryDaoImpl<br>
 * @author：guoqi
 * @since：2017年03月27日 14时10分23秒 星期一 
 * @version:1.0
 */
@Repository("preparationInventoryDao")
public class PreparationInventoryDaoImpl extends GenericDaoDefault<PreparationInventory> implements PreparationInventoryDao{

	@Override
	public Integer count(PageQuery<PreparationInventoryDto> pageQuery) {
		return (Integer) super.queryOne("count",pageQuery);
	}

	@SuppressWarnings("unchecked")
	@Override
	public List<PreparationInventoryDto> queryPageList(
			PageQuery<PreparationInventoryDto> pageQuery,Integer itemCount) {
		PageQueryWrapper<PreparationInventoryDto> wrapper = new PageQueryWrapper<PreparationInventoryDto>(pageQuery.getPageNo(), pageQuery.getPageSize(),itemCount, pageQuery.getQuery());
		return (List<PreparationInventoryDto>)super.query("queryPageList",wrapper);
	}

	@Override
	public int getMaxNo(String no){
		String maxNo = (String) super.queryOne("getMaxNo",no);
		if(maxNo == null){
			return 0;
		}
		return Integer.parseInt(maxNo);
	}

	@Override
	public PreparationInventoryDto queryByNo(String barCode) {
		return (PreparationInventoryDto)super.queryOne("queryByNo",barCode);
	}

	@SuppressWarnings("unchecked")
	@Override
	public List<PreparationInventoryDto> queryList(PageQuery<PreparationInventoryDto> pageQuery) {
		return (List<PreparationInventoryDto>)super.query("queryList",pageQuery);
	}

	@SuppressWarnings("unchecked")
	@Override
	public List<PreparationInventoryDto> getToPrintList() {
		return (List<PreparationInventoryDto>)super.query("getToPrintList",new Object());
	}
}

